package top.superflow.flow.config.parse.impl

import top.superflow.exception.RequestUnsupportedException
import top.superflow.flow.config.ResourceConfig
import top.superflow.flow.config.parse.Parser
import top.superflow.flow.runtime.resource.RuntimeResource

abstract class ResourceConfigParser  extends Parser[RuntimeResource] {

  override def parse(original: Any): RuntimeResource = {
    original match {
      case resourceConfig : ResourceConfig => {
        this.parse(resourceConfig)
      }
      case _ => {
        throw new RequestUnsupportedException(original)
      }
    }
  }

  protected def parse(resourceConfig : ResourceConfig) : RuntimeResource

}
